package com.ims.core.doc.service.impl;

import java.util.List;

import com.ims.common.annotation.RequestParamsSplit;
import com.ims.common.utils.DateUtils;
import com.ims.common.utils.uuid.IdUtils;
import com.ims.core.doc.domain.*;
import com.ims.core.doc.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ims.core.doc.mapper.TInNonInvoiceMapper;

/**
 * 进项非增值发票Service业务层处理
 *
 * @author IMS
 * @date 2024-11-20
 */
@Service
public class TInNonInvoiceServiceImpl implements ITInNonInvoiceService
{
    @Autowired
    private TInNonInvoiceMapper tInNonInvoiceMapper;

    @Autowired
    private ITInNon1002Service itInNon1002Service;

    @Autowired
    private ITInNon1003Service itInNon1003Service;

    @Autowired
    private ITInNon1004Service itInNon1004Service;

    @Autowired
    private ITInNon1005Service itInNon1005Service;

    @Autowired
    private ITInNon1006Service itInNon1006Service;

    @Autowired
    private ITInNon1007Service itInNon1007Service;

    @Autowired
    private ITInNon1008Service itInNon1008Service;

    @Autowired
    private ITInNon1009Service itInNon1009Service;

    @Autowired
    private ITInNon1010Service itInNon1010Service;

    @Autowired
    private ITInNon1011Service itInNon1011Service;

    @Autowired
    private ITInNon1012Service itInNon1012Service;

    @Autowired
    private ITInNon1013Service itInNon1013Service;

    @Autowired
    private ITInNon1016Service itInNon1016Service;

    @Autowired
    private ITInNon99Service itInNon99Service;

    @Autowired
    private ITInInvoice51Service itInInvoice51Service;


    /**
     * 查询进项非增值发票
     *
     * @param id 进项非增值发票主键
     * @return 进项非增值发票
     */
    @Override
    public TInNonInvoice selectTInNonInvoiceById(Long id)
    {
        return tInNonInvoiceMapper.selectTInNonInvoiceById(id);
    }

    /**
     * 查询进项非增值发票列表
     *
     * @param tInNonInvoice 进项非增值发票
     * @return 进项非增值发票
     */
    @Override
    @RequestParamsSplit
    public List<TInNonInvoice> selectTInNonInvoiceList(TInNonInvoice tInNonInvoice)
    {
        return tInNonInvoiceMapper.selectTInNonInvoiceList(tInNonInvoice);
    }

    /**
     * 新增进项非增值发票
     *
     * @param tInNonInvoice 进项非增值发票
     * @return 结果
     */
    @Override
    public int insertTInNonInvoice(TInNonInvoice tInNonInvoice)
    {
        tInNonInvoice.setInvoiceId(IdUtils.simpleUUID());
        tInNonInvoice.setCreateTime(DateUtils.getNowDate());
        return tInNonInvoiceMapper.insertTInNonInvoice(tInNonInvoice);
    }

    /**
     * 新增各类进项非增值发票
     *
     * @param object 各类进项非增值发票
     * @return 结果
     */
    @Override
    public int insertTInNonInvoiceX(Object object) {
        if(object.getClass().equals(TInNon1002.class)){
            return itInNon1002Service.insertTInNon1002((TInNon1002) object);
        } else if(object.getClass().equals(TInNon1003.class)){
            return itInNon1003Service.insertTInNon1003((TInNon1003) object);
        } else if(object.getClass().equals(TInNon1004.class)){
            return itInNon1004Service.insertTInNon1004((TInNon1004) object);
        } else if(object.getClass().equals(TInNon1005.class)){
            return itInNon1005Service.insertTInNon1005((TInNon1005) object);
        } else if(object.getClass().equals(TInNon1006.class)){
            return itInNon1006Service.insertTInNon1006((TInNon1006) object);
        } else if(object.getClass().equals(TInNon1007.class)){
            return itInNon1007Service.insertTInNon1007((TInNon1007) object);
        } else if(object.getClass().equals(TInNon1008.class)){
            return itInNon1008Service.insertTInNon1008((TInNon1008) object);
        } else if(object.getClass().equals(TInNon1009.class)){
            return itInNon1009Service.insertTInNon1009((TInNon1009) object);
        } else if(object.getClass().equals(TInNon1009.class)){
            return  itInNon1010Service.insertTInNon1010((TInNon1010) object);
        } else if(object.getClass().equals(TInNon1011.class)){
            return  itInNon1011Service.insertTInNon1011((TInNon1011) object);
        } else if(object.getClass().equals(TInNon1012.class)){
            return  itInNon1012Service.insertTInNon1012((TInNon1012) object);
        } else if(object.getClass().equals(TInNon1013.class)){
            return  itInNon1013Service.insertTInNon1013((TInNon1013) object);
        } else if(object.getClass().equals(TInNon1016.class)){
            return  itInNon1016Service.insertTInNon1016((TInNon1016) object);
        } else if(object.getClass().equals(TInNon99.class)){
            return  itInNon99Service.insertTInNon99((TInNon99) object);
        }
        return 0;
    }

    /**
     * 修改进项非增值发票
     *
     * @param tInNonInvoice 进项非增值发票
     * @return 结果
     */
    @Override
    public int updateTInNonInvoice(TInNonInvoice tInNonInvoice)
    {
        tInNonInvoice.setUpdateTime(DateUtils.getNowDate());
        return tInNonInvoiceMapper.updateTInNonInvoice(tInNonInvoice);
    }

    /**
     * 批量删除进项非增值发票
     *
     * @param ids 需要删除的进项非增值发票主键
     * @return 结果
     */
    @Override
    public int deleteTInNonInvoiceByIds(Long[] ids)
    {
        return tInNonInvoiceMapper.deleteTInNonInvoiceByIds(ids);
    }

    /**
     * 删除进项非增值发票信息
     *
     * @param id 进项非增值发票主键
     * @return 结果
     */
    @Override
    public int deleteTInNonInvoiceById(Long id)
    {
        return tInNonInvoiceMapper.deleteTInNonInvoiceById(id);
    }
}
